#pragma once
#include <list>
#include <memory>
class Task;

class MessageLoop
{
public:
	MessageLoop();
	~MessageLoop();

	static MessageLoop& getInstance()
	{
		static MessageLoop loop;
		return loop;
	}

	bool init();

	bool run();

	bool quit();

	bool addTask(std::shared_ptr<Task> task);

private:
	bool processNextWinMessage();

	bool processMessage(MSG& msg);

	bool processDelayWork();

	void wait4Work();

	int getDelayTaskTime();

private:
	bool m_isQuit;

	std::list<std::shared_ptr<Task>> tasks_;
};

